home *** CD-ROM | disk | FTP | other *** search
/ Mac-Source 1994 July / Mac-Source_July_1994.iso / Other Langs / Tickle-4.0 (tcl) / library / help / tcl / files / flock < prev    next >
Encoding:
Text File  |  1993-10-26  |  1.8 KB  |  35 lines  |  [TEXT/$Tcl]

  1.  
  2.  
  3.           flock options fileId ?start? ?length? ?origin?
  4.                This command places a lock on all or part of  the  file
  5.                specified  by  fileId.   The lock is either advisory or
  6.                mandatory, depending on the mode bits of the file.  The
  7.                lock  is placed beginning at relative byte offset start
  8.                for length bytes.  If start or  length  is  omitted  or
  9.                empty,  zero  is  assumed.  If length is zero, then the
  10.                lock always extents to end of file, even  if  the  file
  11.                grows.   If origin is "start", then the offset is rela-
  12.                tive to the beginning of the file. If it is  "current",
  13.                it  is  relative  to the current access position in the
  14.                file.  If it is "end", then it is relative to the  end-
  15.                of-file  (a  negative  is  before  the EOF, positive is
  16.                after).  If origin is omitted, start is assumed.
  17.  
  18.                The following options are recognized:
  19.  
  20.                -read - Place  a  read  lock  on  the  file.   Multiple
  21.                processes may be accessing the file with read-locks.
  22.  
  23.                -write - Place a write lock on the file.  Only one pro-
  24.                cess may be accessing a file if there is a write lock.
  25.  
  26.                -nowait - If specified, then the process will not block
  27.                if the lock can not be obtained.  With this option, the
  28.                command returns 1 if the lock is obtained and 0  if  it
  29.                is not.
  30.  
  31.                See your system's fcntl system call  documentation  for
  32.                full details of the behavior of file locking.  If lock-
  33.                ing is being done on ranges of a file, it  is  best  to
  34.                use unbuffered file access (see the fcntl command).
  35.